<%--
  Created by IntelliJ IDEA.
  User: XCQ
  Date: 2021/11/1
  Time: 17:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        tr {
            height: 40px;
            /*行文本居中*/
            text-align: center;
        }

        table {
            /*table表格在页面居中显示*/
            margin: auto;
            /*
             border-collapse 属性设置表格的边框是否被合并为一个单一的边框
             属性值是collapse：如果可能，边框会合并为一个单一的边框。会忽略 border-spacing属性
            */
            border-collapse: collapse;
        }
    </style>
</head>
<body>
<table border="1px" cellspacing="0" width="600">
    <caption><h2>书籍列表</h2></caption>
    <tr>
        <th>编号</th>
        <th>书籍名称</th>
        <th>作者</th>
        <th>价格</th>
    </tr>

<%--    遍历集合,拿到所有的数据--%>
    <c:forEach var="book" items="${books}">
        <tr>
            <td>${book.id}</td>
            <td>${book.name}</td>
            <td>${book.author}</td>
            <td>${book.price}</td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
